package com.ktwlsoft.archivemanage.controller.dataProfile;

import com.ktwlsoft.archivemanage.domain.business.repositoryService.view.BusinessGuideDataProfileRepositoryService;
import com.ktwlsoft.archivemanage.payload.Result;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.time.Year;

@Api(value = "自查复查业务检查数据分析",description = "自查复查业务检查数据分析",tags = "1.2")
@RestController
@RequestMapping("/selfOrRepeatBusinessGuideDataProfile")
public class SelfOrRepeatBusinessGuidDataProfileController {

    private final BusinessGuideDataProfileRepositoryService businessGuideDataProfileRepositoryService;

    public SelfOrRepeatBusinessGuidDataProfileController(BusinessGuideDataProfileRepositoryService businessGuideDataProfileRepositoryService) {
        this.businessGuideDataProfileRepositoryService = businessGuideDataProfileRepositoryService;
    }

    @ApiOperation("立档单位数量在得分分值区间上的分布")
    @GetMapping("/getMarkDistribution")
    public ResponseEntity<?> getMarkDistribution(@ApiParam("年度时间") @RequestParam Year data) {
        return ResponseEntity.ok(Result.ok(businessGuideDataProfileRepositoryService.getProfileBusinessGuideMarkDistributionMapper().selfSelectAll(data)));
    }

    @ApiOperation("考核得分历年变化趋势")
    @GetMapping("/getUnitMarkVariation")
    public ResponseEntity<?> getUnitMarkVariation(@ApiParam("单位") @RequestParam Long unit) {
        return ResponseEntity.ok(Result.ok(businessGuideDataProfileRepositoryService.getProfileBusinessGuideUnitMarkVariationMapper().selfSelectAll(unit)));
    }

    @ApiOperation("立档单位考核平均分历年变化趋势")
    @GetMapping("/getMarkVariation")
    public ResponseEntity<?> getMarkVariation() {
        return ResponseEntity.ok(Result.ok(businessGuideDataProfileRepositoryService.getProfileBusinessGuideMarkVariationMapper().selfSelectAll()));
    }

}
